<template>
  <div>
    <i-page-header class="product_tabs" title="商户修改日志">
    </i-page-header>
    <Card :bordered="false" dis-hover class="ivu-mt">


      <Form ref="formValidate" :model="formValidate">
        <Row type="flex" :gutter="24">
          <Col>
            <FormItem label="商户名称：">
              <Input style="width: 140px;" placeholder="商户名称" v-model="formValidate.m_name"/>
            </FormItem>
          </Col>

          <Col>
            <FormItem label="　" label-for="uid">
              <Button type="primary" icon="ios-search" label="default" class="mr15" @click="getSearch">搜索</Button>
            </FormItem>
          </Col>
        </Row>
      </Form>

      <Table :columns="columns1" :data="tableData" class="mt25" no-userFrom-text="暂无数据"
             no-filtered-userFrom-text="暂无筛选结果"  :loading="loading" highlight-row>


      </Table>

      <div class="acea-row row-right page">
        <Page :total="page.count" show-elevator show-total @on-change="tapPage"
              :page-size="page.pageSize"/>
      </div>
    </Card>

  </div>
</template>

<script>
import IPageHeader from "@/layouts/system/page-header/index";
import VueUeditorWrap from 'vue-ueditor-wrap';
import { mapState, mapActions } from 'vuex';
import UiUpload from "@/ui/upload/index";
import Setting from "@/setting";
import {SystemArea} from "../../../api/system/pub";
import UiUploadMuch from "../../../ui/upload/more_index";
import {
  SystemMember,
  SystemMemberMentorSave, SystemMemberVipDel,
  SystemMemberVipList,
  SystemMemberVipSave
} from "../../../api/system/member";
import {
  SystemMerchantsAll, SystemMerchantsShDel, SystemMerchantsShInit, SystemMerchantsShDelList, SystemMerchantsDelfirsur,
  SystemMerchantsUserDel,SystemMerchantsShDelsq,SystemMerchantsupdLogList,
  SystemMerchantsUserList,
  SystemMerchantsUserSave
} from "../../../api/system/merchants";
import UserInfo from "../member/userInfo.vue";
import {SystemProjectInit} from "../../../api/system/project";
export default {
  name: "merchants_index",
  components: {UserInfo, UiUploadMuch,VueUeditorWrap, UiUpload, IPageHeader},
  computed: {
  },
  data() {
    return {
      title:"详情操作",
      dialogVisible:false,
      upHeaders:{},
      upUrl:"",
      grid: {
        xl: 7,
        lg: 7,
        md: 12,
        sm: 24,
        xs: 24
      },

      formValidate:{},
      columns1: [
        {
          title: 'ID',
          key: 'id',
          width: 80
        },
        {
          title: '店铺ID',
          key: 'm_id',
          minWidth: 150,
          align:'center'
        },
		{
		  title: '店铺名称',
		  key:"m_name",
		  minWidth: 100,
		  align:'center'
		},
		{
		  title: '操作者id',
		  key:"admin_id",
		  minWidth: 100,
		  align:'center'
		},
		{
		  title: '操作者名称',
		  key:"admin_name",
		  minWidth: 100,
		  align:'center'
		},
		{
		  title: '内容',
		  key:"content",
		  minWidth: 100,
		  align:'center'
		},
        {
          title: '操作时间',
          key:"time",
          minWidth: 100,
          align:'center'
        }
      ],
      userInfoUi : [],
      loading: true,
      tableData: [],
      page : {
        count : 0,//一共多少数量
        pageSize : 0,//每一页码数量
        page : 1,//当前页码
      },


      merchantsAr:[],
      activeName : "tab_",
      tabsAr : [],

      dialogVisible2:false,
      form : {

      }

    }
  },

  created () {
    this.initView();
  },
  methods: {
    initView: function () {
      this.getMemberData()
    },


    /**
     * 新闻列表
     */
    getMemberData () {
      this.loading = true
      SystemMerchantsupdLogList({
        page: this.page.page,
        ...this.formValidate,
        type : this.activeName.replace("tab_","")
      })
          .then(res => {
            if (res.code == 200) {
              this.tableData = res.data.list;
              this.loading = false

              this.page.pageSize = res.data.pageSize;
              this.page.count = res.data.pageCount;
              console.log(this.page)
            } else {
              this.loading = false
              this.$alert(res.msg)
            }
          }).catch(res => {
        console.log(res)
        this.loading = false
        this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
      })
    },
    /**
     * 关闭
     */
    editClose:function(){
      this.dialogVisible = false;
    },
    /**
     * 修改数据
     */
    tapShSubmit:function(){

      if(this.form.sh_type == "" || this.form.sh_type == null) {
        this.$alert("请输入审核状态");
        return;
      }

      let loading = this.$loading("提交数据中...");
      SystemMerchantsShSub(this.form)
          .then(res => {
            loading.close();
            if (res.code == 200) {
              this.dialogVisible2 = false;
              this.$Message.success("操作成功");
              this.getMemberData();
            } else {
              this.$alert(res.msg, '系统提示');
            }
          })
          .catch(err => {
            loading.close();
            this.$alert("网络繁忙，加载失败，请稍等片刻在尝试!", '系统提示');
          });
    },
    /**
     * tab数据
     */
    tapTabs:function (){
      this.page.page = 1;
      this.getMemberData();
    },
    /**
     * 分页
     */
    tapPage: function (index) {
      this.page.page = index
      this.getMemberData()
    },

    getSearch:function (){
      this.page.page = 1;
      this.getMemberData();
    },

    tapSh:function (row){
     // this.dialogVisible2 = true;
     // this.form = JSON.parse(JSON.stringify(item));
	  
	    this.$utils
	        .confirm(this,{title : "确定审核吗？审核后将会删除商户", success:()=>{
	            return SystemMerchantsDelfirsur({id : row.id});
	          }}).then(res=>{
	      if (res.code == 200) {
	        this.$message({message: res.msg, type: 'success'});
	        this.getMemberData();
	      } else {
	        this.$alert(res.msg);
	      }
	    }).catch(err => {
	      console.log(err);
	      this.$alert("网络繁忙，加载失败，请稍等片刻在尝试!", '系统提示');
	    });
	  
	  
    },


    tapDel:function (row) {
      this.$utils
          .confirm(this,{title : "确定要移除本次申请删除吗？", success:()=>{
              return SystemMerchantsShDelsq({id : row.id});
            }}).then(res=>{
        if (res.code == 200) {
          this.$message({message: res.msg, type: 'success'});
          this.getMemberData();
        } else {
          this.$alert(res.msg);
        }
      }).catch(err => {
        console.log(err);
        this.$alert("网络繁忙，加载失败，请稍等片刻在尝试!", '系统提示');
      });
    }


  }
}
</script>
<style scoped>
.platform-img{width: 20px;height: 20px;background: #f2f2f2; margin-right: 4px;}
.platform-img img{ width: 100%;}
</style>
